unit Dates1Form;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TDate = class
    Month, Day, Year: Integer;
    procedure SetValue (m, d, y: Integer);
    function LeapYear: Boolean;
  end;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Label1: TLabel;
    EditYear: TEdit;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TDate.SetValue (m, d, y: Integer);
begin
  Month := m;
  Day := d;
  Year := y;
end;

function TDate.LeapYear: Boolean;
begin
  // call IsLeapYear in SysUtils.pas
  Result := IsLeapYear (Year);
end;

procedure TForm1.Button1Click(Sender: TObject);
var
  ADay: TDate;
begin
  // create an object
  ADay := TDate.Create;
  // use the object
  ADay.SetValue (1, 1, StrToInt (EditYear.Text));
  if ADay.LeapYear then
    ShowMessage ('Leap year: ' + IntToStr (ADay.Year));
  // destroy the object
  ADay.Free;
end;

end.
